package com.gitee.bridge.function;

import com.gitee.bridge.function.factory.RegisterLoginComponentFactory;
import com.gitee.pojo.UserInfo;
import com.gitee.repo.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 用户登录 第三方登录
 * 具体实现化角色   默认方式登录
 *
 * @author acao
 * @since 2023-11-06 09:56
 */
@Component
public class RegisterLoginByDefault extends AbstractRegisterLoginFunc implements RegisterLoginFuncInterface {

    @Autowired
    private UserRepository userRepository;

    @PostConstruct
    private void initFuncMap() {
        RegisterLoginComponentFactory.funcMap.put("Default", this);
    }

    @Override
    public String login(String account, String password) {
        return super.commonLogin(account, password, userRepository);
    }

    @Override
    public String register(UserInfo userInfo) {
        return super.commonRegister(userInfo, userRepository);
    }
}
